<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2021/8/20
  Time: 19:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>信息管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.5.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        function updateSubmit(){
            $("#updateForm").submit();
        }
    </script>
</head>

<body>
<!-- 导航条 -->
<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <!-- 屏幕自适应 -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">信息管理系统<small> V1.0</small></a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <!-- 导航条最右边 -->
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">欢迎: <span class="text-danger">${name}</span></a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">个人中心<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">我的积分</a></li>
                        <!-- 分隔线 -->
                        <li role="separator" class="divider"></li>
                        <li><a href="#">修改密码</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">我的消息</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>
<!-- 页面中心内容 -->
<div class="row">
    <div class="col-md-2">
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
            <!-- 一个面板 -->
            <div class="panel panel-default">
                <div class="panel-heading" role="tab" id="headingOne">
                    <h4 class="panel-title">
                        <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                            <span class="glyphicon glyphicon-knight"></span>信息管理
                        </a>
                    </h4>
                </div>
                <div id="collapseOne" class="panel-collapse collapse " role="tabpanel" aria-labelledby="headingOne">
                    <div class="panel-body">
                        <!-- 列表组 -->
                        <ul class="list-group">
                            <li class="list-group-item"><a href="${pageContext.request.contextPath}/pManager/select.action?id=${id}">个人信息</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- 一个面板 -->
            <div class="panel panel-default">
                <div class="panel-heading" role="tab" id="headingTwo">
                    <h4 class="panel-title">
                        <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
                            <span class="glyphicon glyphicon-user"></span>部门管理
                        </a>
                    </h4>
                </div>
                <div id="collapseTwo" class="panel-collapse collapse " role="tabpanel" aria-labelledby="headingTwo">
                    <div class="panel-body">
                        <!-- 列表组 -->
                        <ul class="list-group">
                            <li class="list-group-item"><a href="${pageContext.request.contextPath}/pManager/selectStaff.action?departmentName=${departmentName}">职员列表</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-10">
        <!-- 页头 -->
        <div class="page-header" style="margin-top: -20px;margin-bottom: 0px;">
            <h3>信息管理</h3>
        </div>
        <!-- 标签页 -->
        <div>
            <!-- Nav tabs -->
            <ul class="nav nav-tabs list-unstyled" role="tablist">
                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">个人信息</a></li>
                <li><button class="btn btn-success btn-sm"  data-toggle="modal" data-target="#updateUserModal" style="margin-top: 6px;">修改个人信息</button></li>
            </ul>

            <!-- Tab panes -->
            <div class="tab-content" id="split">
                <div role="tabpanel" class="tab-pane active" id="home">
                    <!-- 用户表格 -->
                    <table id="table" class="table table-bordered table-hover table-striped">
                        <tr>
                            <th>姓名</th>
                            <th>年龄</th>
                            <th>性别</th>
                            <th>工资</th>
                            <th>电话</th>
                            <th>部门</th>
                        </tr>
                        <tr>
                            <td>${pManager.managerName}</td>
                            <td>${pManager.managerAge}</td>
                            <td>${pManager.managerSex}</td>
                            <td>${pManager.managerWage}</td>
                            <td>${pManager.managerPhone}</td>
                            <td>${pManager.departmentName}</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 更新用户的模态框，id为updateUserModal -->
<div class="modal fade" tabindex="-1" role="dialog" id="updateUserModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">保存个人信息</h4>
            </div>
            <div class="modal-body">
                <form method="post" action="${pageContext.request.contextPath}/pManager/update.action" id="updateForm">
                    <div class="form-group">
                        <label for="id2">账号</label>
                        <input value="${pManager.managerId}" readonly type="text" class="form-control" name="managerId" id="id2" placeholder="账号">
                    </div>
                    <div class="form-group">
                        <label for="password2">密码</label>
                        <input value="${pManager.managerPassword}" type="password" class="form-control" name="managerPassword" id="password2" placeholder="密码">
                    </div>
                    <div class="form-group">
                        <label for="name2">姓名</label>
                        <input value="${pManager.managerName}" type="text" class="form-control" name="managerName" id="name2" placeholder="姓名">
                    </div>
                    <div class="form-group">
                        <label for="age2">年龄</label>
                        <input value="${pManager.managerAge}" type="text" class="form-control" name="managerAge" id="age2" placeholder="年龄">
                    </div>
                    <div class="form-group">
                        <label for="sex2">性别</label>
                        <input value="${pManager.managerSex}" type="text" class="form-control" name="managerSex" id="sex2" placeholder="性别">
                    </div>
                    <div class="form-group">
                        <label for="wage2">工资</label>
                        <input value="${pManager.managerWage}" readonly type="text" class="form-control" name="managerWage" id="wage2" placeholder="工资">
                    </div>
                    <div class="form-group">
                        <label for="phone2">电话</label>
                        <input value="${pManager.managerPhone}" type="text" class="form-control" name="managerPhone" id="phone2" placeholder="电话">
                    </div>
                    <div class="form-group">
                        <label for="department2">部门</label>
                        <input value="${pManager.departmentName}" readonly type="text" class="form-control" name="departmentName" id="department2" placeholder="部门">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消更新</button>
                <button type="button" class="btn btn-primary" onclick="updateSubmit()">确认更新</button>
            </div>
        </div>
    </div>
</div>
</body>

</html>
